package plus.easydo.easypush.dingtalk;

/**
 * 工作通知类型枚举类
 * @author laoyu
 * @version 1.0
 * @date 2022/2/25
 */
public enum DingTalkWorkNoticeEnum {

    /** 注意 OA消息支持通过status_bar参数设置消息的状态文案和颜色，消息发送后可调用更新工作通知状态栏接口更新消息状态和颜色。*/
    TEXT("文本消息","text"),
    IMAGE("图片消息","image"),
    VOICE("语音消息","voice"),
    FILE("文件消息","file"),
    LINK("链接消息","link"),
    OA("OA消息","oa"),
    MARKDOWN("Markdown消息","markdown"),
    CARD("卡片消息","action_card");

    private final String name;

    private final String type;

    DingTalkWorkNoticeEnum(String name, String type) {
        this.name = name;
        this.type = type;
    }

    public String getName() {
        return name;
    }

    public String getType() {
        return type;
    }

    public static DingTalkWorkNoticeEnum getEnumByType(String type){
        DingTalkWorkNoticeEnum[] a = DingTalkWorkNoticeEnum.values();
        for (DingTalkWorkNoticeEnum dingTalkWorkNoticeEnum : a) {
            if (dingTalkWorkNoticeEnum.getType().contains(type)) {
                return dingTalkWorkNoticeEnum;
            }
        }
        return null;
    }
}
